package com.wxzhou.wangzhuan.entity;

/**
 * 提现状态枚举
 */
public enum WithdrawalStatus {
    /**
     * 处理中
     */
    PROCESSING(1, "处理中"),
    
    /**
     * 成功
     */
    SUCCESS(2, "成功"),
    
    /**
     * 失败
     */
    FAILED(3, "失败"),
    WAITTING(4, "已打款，等待结果确认");

    private final int code;
    private final String description;

    WithdrawalStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static WithdrawalStatus fromCode(int code) {
        for (WithdrawalStatus status : WithdrawalStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown withdrawal status code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}